package com.lsege.controller.backstage;

import com.github.pagehelper.PageHelper;
import com.lsege.entity.JsonResult;
import com.lsege.entity.Page;
import com.lsege.entity.backstage.MallOrder;
import com.lsege.service.backstage.MallOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by Administrator on 2017/7/6.
 */
@RestController
@RequestMapping("/mallOrder")
public class MallOrderController {
    @Autowired
    MallOrderService mallOrderService;

    @GetMapping("getMallOrderList")
    public JsonResult getMallOrderList(Integer pageNum,Integer pageSize){
        JsonResult json = new JsonResult();
        PageHelper.startPage(pageNum,pageSize);
        List<MallOrder> list = mallOrderService.getMallOrderList();
        Long total = mallOrderService.getMallOrderCount();
        json.setData(new Page(list,total,pageSize,pageNum));
        json.setSuccess(true);
        json.setMessage("获取成功");
        return json;
    }
}
